//package com.chengyu.core.util;
//
//import cn.hutool.core.util.ObjectUtil;
//import com.chengyu.core.domain.result.ShopAccountDetails;
//import com.chengyu.core.exception.CommonException;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.context.SecurityContextHolder;
//
///**
// * security工具类
// */
//public class SecurityUtil {
//
//    /**
//     * 获取管理员信息（从security中）
//     */
//    public static ShopAccountDetails getLoginUserVo() {
//        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
//        ShopAccountDetails shopAccountDetails = (ShopAccountDetails) authentication.getPrincipal();
//        if (ObjectUtil.isNull(shopAccountDetails)) {
//            throw new CommonException("登录信息已过期，请重新登录");
//        }
//        return shopAccountDetails;
//    }
//
//}
